from django.shortcuts import render
from .models import Question

# Create your views here.
def index(request):
    polls_question_query = """
    SELECT id, question_text, pub_date
    FROM mysite.polls_question;
    """
    last_question_list=list(Question.objects.raw(polls_question_query))
    for question_query in last_question_list:
        print(question_query.id, question_query.question_text, question_query.pub_date)

        # 往前短传的内容
    context ={
        'last_question_list': last_question_list
    }
    return render(request,'polls/index.html',context)
